package net.googlecode.harchenko.task3;

import java.math.BigDecimal;

/**
 * Created by IntelliJ IDEA.
 * User: dima
 * Date: 3/25/11
 * Time: 8:36 PM
 * To change this template use File | Settings | File Templates.
 */

/**
 * Salary test. Creates employees and counts them salary.
 */
public class SalaryApp {
    private static SalaryCalculator cal = new SalaryCalculator();

    /**
     * Prints information about salary.
     *
     * @param person Person, whoos salary is calculating.
     */
    private static void outCalc(Person person) {
        try {
            System.out.println(person + ",salary:$" + cal.calcSalary(person));
        } catch (Exception ex) {
        }
    }

    /**
     * Manager without bonus.
     */
    static private Manager manager1 = new Manager("Ivan", "Ivanov", 30,
            new BigDecimal(25), true, new BigDecimal(0));

    /**
     * Manager with bonus.
     */
    static private Manager manager2 = new Manager("Petr", "Petrov", 35,
            new BigDecimal(5000), false, new BigDecimal(1000));

    /**
     * Employee with bonus.
     */
    static private Employee employee1 = new Employee("Semen", "Semenov", 55,
            new BigDecimal(8), true, new BigDecimal(1500), new BigDecimal(5));

    /**
     * Employee without bonus.
     */
    static private Employee employee2 = new Employee("Sergey", "Sergeev", 45,
            new BigDecimal(200), false, new BigDecimal(0), new BigDecimal(15));
    /**
     * Boss.
     */
    static private Director director = new Director("Pankrat", "Pankratovich", 55,
            new BigDecimal(35), new BigDecimal(2000));

    /**
     * Counts employees salary.
     *
     * @param args Command line arguments.
     */
    public static void main(String[] args) {
        SalaryApp app = new SalaryApp();
        outCalc(manager1);
        outCalc(manager2);
        outCalc(employee1);
        outCalc(employee2);
        outCalc(director);


    }


}
